package com.team.mp.vo;

import com.team.mp.constants.Rcode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private int code;
    private String msg;
    private Object data;

    public static R ok(Object data) {
        return new R(Rcode.OK, "操作成功", data);
    }

    public static R ok() {
        return ok(null);
    }

    public static R fail(String msg) {
        return new R(Rcode.FAIL, msg, null);
    }

    public static R fail() {
        return fail("操作失败");
    }

}
